<style>
  #app{display: table;width:100%;}
  body{background: #fff;}
.accountassets   .main-title{text-align: center;font-size:16px;font-weight: normal;margin-bottom: 20px;}
.accountassets   .des{text-align: center;color:#999;margin-bottom: 2em;}
  /*.login-form{width: 400px;margin:13% auto 0;}*/
.accountassets .login-page{width:400px;height:400px;margin:0 auto; padding: 20px 30px;
    border-radius: 8px;
    background: #fff;}

/*  .login_main{    height: 99.8vh; background: #fff;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;}*/
.accountassets.login_content{    width: 1200px;margin:0 auto;
    /*height: 99.8vh;*/
    min-height: 99.8vh;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    /*align-items: center;*/

    /*justify-content: center;*/
}
.accountassets .usercenter_header{
	border:1px solid #dcdcdc;
	display: flex;
	height:121px;
	align-items: center;
	margin-top: 20px;
}
.accountassets .header_left,.accountassets .header_right{/*display: flex;*/padding:0 50px;    width: 50%;}
.accountassets .header_right{display: flex;flex-direction: column;justify-content: flex-start;}
.accountassets .header_left{    border-right: 1px solid #dcdcdc;}
.accountassets .header_text{       align-items: center;  padding-top: 20px;display: flex;}
.accountassets .header_right .header_img{font-size:16px;color:#666;}
.accountassets .header_right .header_text{font-size:14px;color:#666;}
/*.accountassets .header_right .header_text span{height:50%;align-items: center;display: flex;}*/
.accountassets .header_img{font-size:20px;}
.accountassets .width_fixed{width:170px;}
.accountassets .el-input__inner{height:32px;}
.accountassets .el-table td{padding:12px 0;}
.accountassets .el-form--inline .el-form-item{margin-bottom: 0;}
.accountassets .hide-small-assets{
	    color: #666;
    font-size: 14px;
    margin: 19px 16px;
}
/*.usercenter_all{width:100%;}*/
.usercernter_ul{
	display: flex;justify-content: space-between;

}
.accountassets .el-button{padding:7px 15px;font-size: 12px;}
.accountassets .el-table th{text-align: left;}
.accountassets .el-table{border:1px solid #ebeef5;margin-top: 10px;}
.accountassets .el-table thead tr th{background: #f5f5f5;}
.accountassets .openRow_content{
	display: flex;
}
.accountassets .openRow_title{
	font-size: 16px;
    color: #000;
    margin-bottom: 19px;
    display: flex;
    justify-content: space-between;
}
.accountassets .el-table__expanded-cell[class*=cell]{padding:20px 25px;}
.accountassets .openRow_left{width: 400px;}
.accountassets .openRow_right{width: 756px;}
.accountassets .openRow_img{display: flex;}
.accountassets .recharge-qrcode{
	    width: 50%;
    text-align: center;
    width: 170px;
    height: 170px;
    margin-right:20px;

}
.accountassets .recharge-qrcode img{width:170px;}
.accountassets .openRow_withdraw{
	    width: 50%;
    height: 170px;
    background: #daedf7;
    border: 1px solid #bee8f0;
    color: #34708d;
    padding: 14px 10px;
    margin-right:20px;
}
.accountassets .copybtn{margin-top:10px;}
.accountassets .openRow_alt{
	    margin-top: 31px;
    font-size: 14px;
    color: #666;
}
.accountassets .openRow_content .el-table{border:none;}
.accountassets .el-form-item__label{padding: 0;}
.accountassets .openRow_img .el-input{width:230px;}
.accountassets .openRow_img .el-input__inner{height: 36px;}
.accountassets .verify .el-form-item__content{
	display: flex;align-items: center;
}
.accountassets .openRow_img .verify .el-input{width: 138px;}
.accountassets .openRow_img .verify .el-input__inner{border-radius: 4px 0 0 4px;}
.accountassets .verify .el-button{height:36px;border-radius: 0 4px 4px 0;}
.accountassets .verification1{background: #f5f7fa;}
.accountassets .add_btn{height:36px;margin-left: 5px;margin-top:2px;width:60px;}
.accountassets .el-dialog__wrapper{
	display: flex;
	align-items: center;
}
.accountassets .el-dialog{width:434px;}
.accountassets .el-dialog__body{ padding:10px;}
.accountassets .el-dialog .el-input__inner{max-width: 283px;}
.accountassets .el-dialog .el-input{margin-left:10px;}


</style>
<template>
  <div class="accountassets">  
      
	<template v-if="routerPath=='accountassets'" >

      <div class="login_content accountassets">  
      		<div class="usercener_all">
  				<div class="usercenter_header">      			
	      			<div class="header_left">
	      				<div class="header_img">
	      					<span>账户资产</span>
	      					
	      				</div>
	      				<div class="header_text">
      					  	<el-form class="width_fixed" :inline="true" :model="filters" >
					            <el-form-item class="table_input">
					           <!--     <el-input clearable  v-model="filters.name" @change="searchChange" placeholder="请输入内容" >
								    <template slot="prepend"><i class="el-icon-search"></i></template>
								  </el-input> -->
							    	<el-autocomplete
						          		clearable
									  v-model="filters.name"
									  :fetch-suggestions="querySearchAsync"
									  placeholder="请输入内容"
									>
									    <template slot="prepend"><i class="el-icon-search"></i></template>
										
									</el-autocomplete>
					            </el-form-item>
					        
				          	</el-form>
	      					<span >
	      						<span class="hide-small-assets">隐藏小额资产</span>
	      						<el-switch
	      							:width="50"
								  v-model="onOff"
								  active-color="#13ce66"
								  inactive-color="rgb(191, 203, 217)"
								  @change="toggleStatus"
								  active-text="on"
								  inactive-text="off"
								 
								  >
								</el-switch>
	      					</span>
	      				</div>
	      			</div>
	      			<div class="header_right">
	      				<div class="header_img">
	      					<span class="money">总当前估值 : $0 / ￥0</span>
	      				</div>
	      				<div class="header_text">
	      					<span> 注: 资金总估是由历史行情估算值，仅为用户提供一个参考，请以单项资金为准</span>

	      				</div>
	      			</div>
	      		</div>
  			</div>   
      		
      		<div class="usercener_all">
      			<el-table ref="multipleTable" :data="list"  style="width: 100%;" :expand-row-keys="expands" :row-key="getRowKeys">	

      				<el-table-column width="50">
			      </el-table-column>			      
			      <el-table-column prop="coinTitle" label="币种">
			      </el-table-column>			   
			      <el-table-column prop="balance" label="总额" sortable>	
			      	<template slot-scope="scope">
			      		{{scope.row.balance+scope.row.freeze}}
			      	</template>		      
			      </el-table-column>
			      <el-table-column prop="balance" label="可用" sortable>			      
			      </el-table-column>		
			      <el-table-column prop="freeze" label="冻结" sortable>			      
			      </el-table-column>		     
			      <el-table-column prop="roleDesc" label="操作">
			      	<template slot-scope="scope">
       
		              <el-button class="span_btn" v-if="scope.row.isAllowRecharge==1 && scope.row.status==1"  @click="handleRecharge(scope.$index, scope.row)" >充值</el-button>
		               <el-button class="span_btn" v-if="scope.row.isAllowRecharge==0 || scope.row.status==2" disabled  >充值</el-button>
		              <el-button class="span_btn"  v-if="scope.row.isAllowWithdraw==1 && scope.row.status==1" @click="handleWithd(scope.$index, scope.row)" >提现</el-button>
		              <el-button class="span_btn"  v-if="scope.row.isAllowWithdraw==0 || scope.row.status==2" disabled >提现</el-button>
		              <el-button class="span_btn"  @click="handleDeal(scope.$index, scope.row)" >交易</el-button>
		             
		            </template>			      
			      </el-table-column>	
			      <el-table-column class="openRow" type="expand" width="1">
				      <template slot-scope="props">
				      	<div v-if="isRecharge"  class="openRow_content">
			      			<div class="openRow_left">
					      		<div class="openRow_title">充值</div>					      		
					      		<div class="openRow_img">
					      			<div class="openRow_withdraw">
					      				<p>钱包地址</p>
					      				<p>{{props.row.address}}</p>
					      				<el-button class="copybtn table_btn_r"  v-clipboard:copy="props.row.address"  v-clipboard:success="onCopy" v-clipboard:error="onError" >复制到剪贴板</el-button>
					      			</div>
					      			<div class="recharge-qrcode">
					      				<!-- <img src="../assets/img/test.png"> -->
					      				  <div id="qcorder">
										    
										    <div class="qart">
										        <div :id="'qrcode'+props.row.coinId" ref="qrcode">
										        </div>
										       
										    </div>
										  
										  </div>
					      			</div>
					      		</div>
					      		<div class="openRow_alt">注意：此地址为 充币地址，非 资产转入将无法找回。</div>
					      	</div>
					      	<div class="openRow_right">
					      		<div class="openRow_title">
					      			
					      			<span>充值记录</span>
					      			<span class="more"><router-link to="/order/rechargerecord">更多</router-link></span>
					      		</div>

					      		<el-table :data="rechargeList" style="width: 100%" max-height="1000">
						       
						          <el-table-column prop="createTime" label="转入时间" >
						          </el-table-column>
						          <el-table-column prop="address" label="转入地址" >
						          </el-table-column>
						         
						          <el-table-column prop="amount" label="转入数量">
						          </el-table-column>
						          <el-table-column prop="fees" label="转入手续费" width="100" >
						          </el-table-column>
						          <el-table-column prop="realAmount" label="实际转入" >
						          </el-table-column>
						          <el-table-column prop="status" label="状态" :formatter="formatSex" >
						          </el-table-column>			         
						       
						        </el-table>
					      	</div>
				      	</div>
				      	<div  v-if="!isRecharge" class="openRow_content">
			      			<div class="openRow_left">
					      		<div class="openRow_title">提现</div>
					      		<div class="openRow_img">
					      			<el-form label-width="75px" label-position="left" :model="withForm" class="login-form" :rules="withFormRules" ref="withForm">
							             <el-form-item label="提取地址"  prop="userWalletId">
							               <el-select v-model="withForm.userWalletId" placeholder="请选择">
										    <el-option
										      v-for="item in walletList"
										      :key="item.userWalletId"
										      :label="item.name"
										      :value="item.userWalletId">
										    </el-option>
										  </el-select>
							            </el-form-item>	
							            <el-form-item label="转出数量" prop="amount">
							              <el-input
							                :autofocus="true"
							                placeholder="转出数量" 
							                v-model="withForm.amount">
							              </el-input>
							            </el-form-item>									           
							            <el-form-item label="手机验证" class="verify" prop="mobileCode">
							              <el-input type="text" placeholder="请输入验证码" class="phoneVerify" v-model="withForm.mobileCode"></el-input>
							              <el-button @click.native="sendVerify" type="default" class="verification1">获取验证码</el-button>

							            </el-form-item>
							             <el-form-item label="交易密码" prop="payPassword" >
							              <el-input type="text" placeholder="请输入交易密码" v-model="withForm.payPassword"></el-input>
							            </el-form-item>
							            <el-form-item class="btn_reg">
							              <el-button  @click.native="withdraw('withForm',props.row)" type="primary" :loading="withdrawLoading">提交</el-button>
							            </el-form-item>
							         
							          </el-form>
						             	<el-button  @click.native="handAdd" class="add_btn" >新增</el-button>
					      		</div>
					      		
					      	</div>
					      	<div class="openRow_right">
					      		<div class="openRow_title">
					      			
					      			<span>提现记录</span>
					      			<span class="more"><router-link to="/order/withdrawalsrecord">更多</router-link></span>
					      		</div>

					      		<el-table :data="withdrawList" style="width: 100%" max-height="1000">
						       
						          <el-table-column prop="createTime" label="转出时间" >
						          </el-table-column>
						          <el-table-column prop="address" label="转出地址" >
						          </el-table-column>
						    
						          <el-table-column prop="amount" label="转出数量">
						          </el-table-column>
						          <el-table-column prop="fee" label="转出手续费" width="100" >
						          </el-table-column>
						          <el-table-column prop="realAmount" label="实际转出" >
						          </el-table-column>
						          <el-table-column prop="status" label="状态" :formatter="formatSexW" >
						          </el-table-column>			         
						       
						        </el-table>
					      	</div>
				      	</div>
				      </template>
				  </el-table-column>
			    </el-table>
			    <!-- table end  -->
			    <!--工具条-->
			    <el-col :span="24" class="toolbar toolbar_footer">			     
			      <el-pagination  layout="prev, pager, next,total,jumper" @current-change="handleCurrentChange" :page-size="showCount" :total="total" style="float:right;">
			      </el-pagination>
			    </el-col>
      		</div>
   			
      </div>
       <!-- 新增页面 -->
         <el-dialog :title="'添加'+selectCoinsName+'地址'" top="0"  class="form_part" :visible.sync="addFormVisible"  :close-on-click-modal="false">
	          <el-form :model="addForm" class="" label-width="85px" :rules="addFormRules" ref="addForm">
	            <!-- <div class="form_left"> -->
	            	<input type="hidden" v-model="coinId">
	              <el-form-item label="地址" prop="address">
	                <el-input v-model="addForm.address" placeholder="填写正确的接收地址" auto-complete="off"></el-input>
	              </el-form-item>
	              <el-form-item label="地址简称" prop="name">
	                <el-input v-model="addForm.name" placeholder="地址简称" auto-complete="off"></el-input>
	              </el-form-item>  				               
	              
	              <el-form-item label="交易密码" prop="payPassword">
	                <el-input v-model="addForm.payPassword" placeholder="交易密码" auto-complete="off"></el-input>
	              </el-form-item>
          		  <el-form-item class="btn_add">
	                 <el-button style="width:100%" type="primary"  @click.native="addSubmit('addForm')" :loading="addLoading">确认</el-button>
	              </el-form-item>
	           
	          </el-form>
	          <!-- <div slot="footer" class="dialog-footer">
	            <el-button style="width:100%" type="primary"  @click.native="addSubmit('addForm')" :loading="addLoading">添加</el-button>
	           
	          </div> -->
        </el-dialog>
    </template>
    <template v-else>
        <router-view></router-view>
    </template>
    
    
   
  </div>
</template>

<script>
import * as users from '../api/users';
import * as coinwallet from '../api/coinwallet';
import * as common from '../api/common';
import QRCode from '../assets/js/qrcode'

import myHeader from './common/header'
import VueClipboard from 'vue-clipboard2'
import Vue from 'vue'

Vue.use(VueClipboard)



var code ; //在全局定义验证码
export default {

  components:{
    myHeader,VueClipboard
  },
  data() {
    return {
    	addLoading:false,
    	withForm:{},
    	withFormRules:{
    		userWalletId: [
	          { required: true, message: '请选择钱包地址', trigger: 'change' },
	        ],
	        amount: [
	          { required: true, message: '请输入金额', trigger: 'blur' },
	        ],
	        mobileCode: [
	          { required: true, message: '请输入验证码', trigger: 'blur' },
	        ],
	        payPassword: [
	          { required: true, message: '请输入交易密码', trigger: 'blur' },
	        ],

    	},
    	selectCoinsName:'',
		addFormVisible:false,
		addForm:{},
		addFormRules:{
	        address: [
	            { required: true, message: '请输入钱包地址', trigger: 'blur' }
	        ],
	        name: [
	            { required: true, message: '请输入地址简称', trigger: 'blur' }
	        ],
	        payPassword: [
	            { required: true, message: '请输入交易密码', trigger: 'blur' }
	        ],
        
    	},
    	isRecharge:true,
    	rechargeList:[],
    	withdrawList:[],
    	linkUrl:'复制内容',
    	expands:[],
    	filters:{name:''},
    	userId:'',
    	list:[{name:'btc',coinId:'152410590155263840',value:'btc',coinWalletId:'111',withForm:{amount:'',userWalletId:'',mobileCode:'',payPassword:''}},{name:'btc',coinId:'2',value:'btc',coinWalletId:'222',withForm:{amount:'',userWalletId:'',mobileCode:'',payPassword:''}}],
    	showCount:20,
		total:0,
      	page: 1,
		onOff:true,
      	loginFormRules:{
        userName: [
            { required: true, message: '请输入姓名', trigger: 'blur' }
          ],
      },
      picLyanzhengma:'',
      checkCode:'',
      loginForm:{region:'china'},
      username: '',
      password: '',
      isBtnLoading: false,
      routerPath:'',
      isRealName:false,
      userInfo:'',
      timeout:null,
      walletList:[],//提现地址
      coinId:'',
      coinWalletId:'',//平台钱包地址
      withdrawLoading:false,
      isSendVerify:false,
      mobile:'',
      verifycode:'1234',
      i:false,
      address:'',//钱包地址
      isOpen:false,//判断表格是否展开
      withShowCount:5,
    };
  },
  computed: {
   
  },
  methods: {
  	  //状态转换

    formatSexW: function (row, column) {
      return row.status == 30 ? '待审核' : row.status == 32 ? '拒绝' :row.status == 31 ? '完成' :row.status == 33 ? '用户撤销' :row.status == 34 ? '打币中' : '处理中';
    },
     //状态转换
    formatSex: function (row, column) {
      return row.status == 30 ? '待审核' : row.status == 31 ? '拒绝' :row.status == 32 ? '完成' :row.status == 40 ? '未付款' :row.status == 41 ? '到账成功' : row.status == 42 ? '人工到账' : '处理中';
    },
	_getQart: function(cid,address) {
		console.log(cid,address)
		//产生二维码
	  	this.$nextTick(() => {

	        // if(this.i==false){
	        	let qrcodeId='qrcode'+cid;
	        	this.$refs.qrcode.innerHTML="";
 				var qrcode = new QRCode(document.getElementById("qrcode"+cid), {
	                width : 170,//设置宽高  
	                height : 170
	            });
	            /*document.getElementById("getval").onkeyup =function(){
	                qrcode.makeCode(document.getElementById("getval").value);
	            };*/
				this.qrcodeText="钱包"+address ;          
	            qrcode.makeCode(this.qrcodeText);//钱包地址

	           

	        // }
	        // this.i = true;
		});


    },
  	searchChange(){
  		console.log("change")
  	},
 	querySearchAsync(queryString, cb) {
 		console.log(queryString);
	    var restaurants = this.list;
	    console.log(restaurants)

	    var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
	    // var results = queryString ?this.fetchData() : restaurants;

	    clearTimeout(this.timeout);
	    this.timeout = setTimeout(() => {
	     cb(results)
	     this.fetchData();
	    }, 3000 * Math.random());
  	},
  	createStateFilter(queryString) {
        return (state) => {

          return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
        };
      },
	onCopy: function (e) {//点击复制链接
		console.log(e)
		this.$message("钱包地址已复制："+e.text);
	},
	onError: function (e) {
        alert('网络错误')
  	},
  	getRowKeys(row) {
            return row.coinId;
    },
  	toggleStatus(){
  		console.log(this.onOff);
  		this.fetchData();
  	},
 	handleCurrentChange(val) {
      this.page = val;
      // this.getUsers();
      this.fetchData();
    },
   sendVerify(){
   	//发送验证码
      	if(this.mobile){
	        let para={
	          mobile:this.mobile,
	          verifyCode:this.verifycode
	        }
	        console.log(para)
	        common.sendVerify.r(para).then((res)=>{
	          console.log(res);
	          if(res.data.retCode==1){
	            this.isSendVerify=true;
	          }else{
	            this.$message(res.data.retMsg);
	          }
	        })
        }
     
    },
    withdraw(index,row){
    	console.log(row);
		//提现申请
      this.$refs.withForm.validate((valid) => {
        if (valid) {
	    /*	if(!this.isSendVerify){
	            this.$message.error("请发送手机验证码");
	            return;
	      	}*/
	      	// this.withdrawLoading=true;
	      	let para={
	      		payPassword:this.withForm.payPassword,
	      		mobileCode:this.withForm.mobileCode,
	      		userWalletId:this.withForm.userWalletId,
	      		coinWalletId:this.coinWalletId,
	      		amount:this.withForm.amount,
	      		userId:this.userId,
	      	}
	      	console.log(para);
	      	// return;
	      	coinwallet.addwithdraw.r(para).then((res)=>{
	      		console.log(res);
	      		if(res.data.retCode==1){
					//提现申请成功
					this.$message("提现申请成功");
					this.fetchDataWithdraw(row);

		  		}else{
		  			this.$message.error(res.data.retMsg);
		  		}
		  		this.withdrawLoading=false;
	      	})

        }else{
          console.log('error submit!!');
          return false;
        }

      })
    },
    handAdd(){
  		//显示新增提现地址页面
  		this.addFormVisible=true;
    },
    addSubmit(){
      //新增提现地址
      this.$refs.addForm.validate((valid) => {
        if (valid) {
      
          this.addLoading=true;
          let para={
            userId:this.userId,
            coinId:this.coinId,
            name:this.addForm.name,
            address:this.addForm.address,
            // payPassword:md5('STARSAND_' + this.addForm.payPassword),
            payPassword:this.addForm.payPassword,
            
          }
          console.log(para);
          // return;
          users.addWallet.r(para).then((res)=>{
            console.log(res);
            if(res.data.retCode==1){
              this.addFormVisible=false;
              this.$message("添加成功")
              this.fetchDataWallet();
            }else{
              this.$message.error(res.data.retMsg);
            }
            this.addLoading=false;
          })

        }else{
          console.log('error submit!!');
          return false;
        }

      })

    },
    fetchDataUser(){
    	//获取用户信息
    	let para={
    		userId:this.userId,
    	}
	  	users.info.r(para).then((res) => {
	  		console.log(res)
	  		if(res.data.retCode==1){
	  			if(res.data.data.realName){
  					this.isRealName=true;
  				}else{
  					this.isRealName=false;
  				}
  				this.userInfo=res.data.data;
  				sessionStorage.setItem("localUser",JSON.stringify(res.data.data))
	  		}else{
	  			this.$message.error(res.data.retMsg);
	  		}
	       
	       

	      });
    },
	fetchDataWallet(init) {
    //获取个人钱包列表--提现地址      
      let para = {
          userId:this.userId,
          coinId:this.coinId,
        };
        console.log(para)
      users.getUserWallet.r(para).then((res) => {
        console.log(res);
        if(res.data.retCode==1){           
            this.walletList=[];
            if(res.data.data.list.length>0){
              // this.total=res.data.data.totalRow;
              this.walletList = res.data.data.list;
              this.list.map(x=>{
              	x.userWalletId=this.walletList[0].userWalletId;
              })
            
              console.log(this.list)
             
            }
        }else{
          this.$message.error(res.data.retMsg);
        }
       

        this.loading = false;
      });
    },
 	fetchData() {
 		//获取平台钱包列表
      this.loading = true;
    /*  if(!this.$_has([users.request])){
        this.$message("暂无权限");
        this.loading = false;

        return;
      }*/
      let para = {
          userId:this.userId,
          keyword:this.filters.name
        };
        console.log(para)
      coinwallet.request.r(para).then((res) => {
      	console.log(res);
      	if(res.data.retCode==1){
      		if(res.data.data.totalRow>0){
      			this.total=parseInt(res.data.data.totalRow);
    			this.list = res.data.data.list;
    			this.list.map(x=>{
    				x.value=x.coinTitle;
    				x.withForm={amount:'',userWalletId:'',mobileCode:'',payPassword:''};
    				x.withdrawList=[];
    			})
    			console.log(this.list)
      		}
  		   
        
      	}else{
      		this.$message.error(res.data.retMsg)
      	}
     
       

        this.loading = false;
      });
    },
    fetchDataRecharge(row) {
  		//获取充值记录
  		this.rechargeList=[];
      let para = {
          userId:this.userId,
          showCount:this.withShowCount,

          coinWalletId:row.coinWalletId
        };
        console.log(para)
      coinwallet.requestList.r(para).then((res) => {
      	console.log(res);
      	if(res.data.retCode==1){
  		   // this.total=res.data.data.totalRow;
    		this.rechargeList = res.data.data.list;
        
      	}else{
      		this.$message.error(res.data.retMsg)
      	}
     
       

      });
    },
   	fetchDataWithdraw(row) {
  		//获取提现记录
  		this.withdrawList=[];
  		console.log(row)
  		 let para = {
          userId:this.userId,
          showCount:this.withShowCount,
          coinWalletId:row.coinWalletId
        };
        console.log(para)

	  	this.$nextTick(() => {
		 	coinwallet.requestWithdrawList.r(para).then((res) => {
		      	console.log(res);
		      	if(res.data.retCode==1){
		      		// this.$set(row,'withdrawList',res.data.data.list)
		    		this.withdrawList = res.data.data.list;
		        
		      	}else{
		      		this.$message.error(res.data.retMsg)
		      	}		     	       

	      	});
	  	})
     
     
    },
 
  	handleRecharge(index,row){
  		//充值展现
		// this.isRecharge=true;

  		if(this.expands.toString()!=row.coinId){
			//不同行展开
	  		// if(this.isOpen){
	  			this.expands = [];
				this.expands.push(row.coinId)
				this._getQart(row.coinId,row.address);
	  			// this.isOpen=true;
	  		// }else{

	  		// }  			
			this.isRecharge=true;

  		}else{
	  		//同行展开
	  		if(this.isRecharge){
				//充值点击了
				this.isOpen=true;
			}else{
				//提现点击了
				this.isOpen=false;
				this.isRecharge=true;

			}

	  		if(this.isOpen){
	  			//展开
	  			this.expands = [];

  				this.isOpen=false;
	  		}else{
				this.expands = [];
				this.expands.push(row.coinId)
				this._getQart(row.coinId,row.address);
	  			this.isOpen=true;
	  		}
	  		
  		}


  	/*	if(this.isRecharge){
			if(this.expands.toString()!=row.coinId){
		  		this.expands = [];
				this.expands.push(row.coinId)
				this._getQart(row.coinId,row.address);

	  		}else{
		  		this.expands = [];
  				this.isRecharge=true;

	  		}
  		}else{
  			this.isRecharge=true;

  		}*/
  		this.coinId=row.coinId;//钱币id
  		this.fetchDataRecharge(row);
		// this._getQart(row.coinId,row.address);
  		
  	},
	handleWithd(index,row){
		//提现展现
		// this.isRecharge=false;
		// this.isRecharge=false;



		if(this.expands.toString()!=row.coinId){
			this.expands = [];
			this.expands.push(row.coinId)
  			// this.isOpen=true;	
			this.isRecharge=false;


		}else{
			//同行展开
			if(this.isRecharge){
				//充值点击了
				this.isOpen=false;
				this.isRecharge=false;

			}else{
				//提现点击了
				this.isOpen=true;
			}

			if(this.isOpen){
	  			//展开
	  			this.expands = [];

  				this.isOpen=false;
	  		}else{
				this.expands = [];
				this.expands.push(row.coinId)
	  			this.isOpen=true;
	  		}

			// this.expands = [];

		}

		/*this.expands = [];
		this.expands.push(row.coinId)*/
		this.coinId=row.coinId;//钱币id
		this.fetchDataWallet();
		this.fetchDataWithdraw(row);
		this.coinWalletId=row.coinWalletId;//平台钱包id

	},
	handleDeal(index,row){
		this.$router.push({path:'/transaction',query:{id:row.coinId}})
	},

  },
	watch: {
      // 如果路由有变化，会再次执行该方法
      "$route": function(){
        this.routerPath=this.$route.path.split("/").pop();
        this.fetchDataUser()

      }
  },
  created() {
    this.routerPath=this.$route.path.split("/").pop();

    // this.fetchDataUser();
    // sessionStorage.setItem('userId','152420221979644577')
    this.userId=sessionStorage.getItem('userId')
    this.mobile=JSON.parse(sessionStorage.getItem('localUser')).mobile;

    this.fetchData();


  }
};
</script>
